<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户编辑</title>
<link href="/resources/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="/resources/lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="/resources/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="/resources/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
<script src="/resources/lib/jquery-validation/jquery.validate.min.js" type="text/javascript"></script> 
<script src="/resources/lib/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="/resources/lib/jquery-validation/messages_cn.js" type="text/javascript"></script>
<script src="/resources/lib/json2.js" type="text/javascript"></script>
<style type="text/css">
    .l-table-edit {}
    .l-table-edit-td-label{width: 100px;padding-top: 5px;}
    .l-table-edit-td-input{width: 200px;padding-top: 5px;}
    .div-buttom{position: absolute;top:380px;}
    
</style>
<script>
var form = null;
 
$(function (){
	form = $("form").ligerForm(
	);
    //工具条
    $("#toptoolbar").ligerToolBar({ items: [
        { text: '保存', id:'save',click: saveForm,icon: 'save' },
        { text: '提交', id:'submit',click: submitForm},
        { text: '审核', id:'audit',click: auditForm},
        { text: '反审核', id:'unAudit',click: unAuditForm}
    ]
    });
	//总界面
    $("#tab1").ligerTab({
    });
});

//保存
function saveForm(){
    var forms = $('#form1').serialize(); 
 	$.ajax({
        loading: '正在保存数据中...',
        type:'post',
        url: "/customer/saveOrUpdateCustomer",
		dataType:'json',
        data: forms,
        success: function (data) {
				$.ligerDialog.success(data.message,'信息',function(){
					$("#uuid").val(data.data.uuid);
					insetBase(data.data);
			    });
        },
        error: function (message) {
       	 	$.ligerDialog.error("保存失败");
        }
    });
}

//提交
function submitForm(){
    var forms = $('#form1').serialize(); 
 	$.ajax({
        loading: '正在提交数据中...',
        type:'post',
        url: "/customer/submitCustomer",
		dataType:'json',
        data: forms,
        success: function (data) {
				$.ligerDialog.success(data.message,'信息',function(){
					insetBase(data.data);
			    });
        },
        error: function (message) {
       	 	$.ligerDialog.error("提交失败");
        }
    });
}

//审核
function auditForm(){
    var forms = $('#form1').serialize(); 
 	$.ajax({
        loading: '正在审核数据中...',
        type:'post',
        url: "/customer/auditCustomer",
		dataType:'json',
        data: forms,
        success: function (data) {
				$.ligerDialog.success(data.message,'信息',function(){
					insetBase(data.data);
			    });
        },
        error: function (message) {
       	 	$.ligerDialog.error("审核失败");
        }
    });
}

//反审核
function unAuditForm(){
    var forms = $('#form1').serialize(); 
 	$.ajax({
        loading: '正在反审核数据中...',
        type:'post',
        url: "/customer/unAuditCustomer",
		dataType:'json',
        data: forms,
        success: function (data) {
				$.ligerDialog.success(data.message,'信息',function(){
					insetBase(data.data);
			    });
        },
        error: function (message) {
       	 	$.ligerDialog.error("反审核失败");
        }
    });
}
//设置基础数据
function insetBase(info){
	if(info.createUser != null){
		$("#createUser").val(info.createUser.trueName);
		$("#createDate").val(info.createDate);
	}
	if(info.alterUser != null){
		$("#alterUser").val(info.alterUser.trueName);
		$("#alterDate").val(info.alterDate);
	}
	
	if(info.auditUser != null){
		$("#auditUser").val(info.auditUser.trueName);
		$("#auditDate").val(info.auditDate);
	}
}
</script>
</head>
<body>
	
	<div id="toptoolbar"></div>
	<div style="width: 100%;height:450px;">
		<form name="form1" method="post" action="" id="form1">
			<input id="uuid" name="uuid" type="hidden" value="${info.uuid}"/> 
		 	<!-- 头部 -->
			<div>
				<table cellpadding="0" cellspacing="0" class="l-table-edit">
					<tr>
	                	<td align="left" class="l-table-edit-td-label">客户编号:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="number" type="text" id="number" value="${info.number}" value="${info.name}"  ltype="text" /></td>
	                	<td align="left" class="l-table-edit-td-label">客户名称:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="name" type="text" id="name" value="${info.name}" value="${info.name}"  ltype="text" /></td>
	                	<td align="left" class="l-table-edit-td-label"></td>
	                	<td align="left" class="l-table-edit-td-input"></td>
	                	<td align="left" class="l-table-edit-td-label"></td>
	                	<td align="left" class="l-table-edit-td-input"></td>
	            	</tr>
				</table>
			</div>
			<!-- 页签 -->
			<div>
			    <div id="tab1" style="width: 99%;height:100% ;overflow:hidden; border:1px solid #A3C0E8;margin-top:10px; "> 
			       	<div title="基本信息" style="height:275px">
						<table cellpadding="0" cellspacing="0" class="l-table-edit">
							<tr>
			                	<td align="left" class="l-table-edit-td-label">业务分析码:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="businessNum" type="text" id="businessNum" value="${info.name}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">内部客户:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="inerCustomer" type="text" id="inerCustomer" value="${info.inerCustomer}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">内部公司:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="inerCompany" type="text" id="inerCompany" value="${info.inerCompany}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">客户性质:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="customerProper" type="text" id="customerProper" value="${info.customerProper}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">上级客户:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="superCustomer" type="text" id="superCustomer" value="${info.superCustomer}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">工商注册号:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="industrialNum" type="text" id="industrialNum" value="${info.industrialNum}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">法人代表:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="legalPerson" type="text" id="legalPerson" value="${info.legalPerson}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">营业执照:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="tradingNum" type="text" id="tradingNum" value="${info.tradingNum}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">经营许可证:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="manageNum" type="text" id="manageNum" value="${info.manageNum}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>       
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">行业:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="industry" type="text" id="industry" value="${info.industry}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">邮政编码:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="zipCode" type="text" id="zipCode" value="${info.zipCode}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">开票类型:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="makeType" type="text" id="makeType" value="${info.makeType}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
			            	<tr>
			            		<td align="left" class="l-table-edit-td-label">税率:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="taxRate" type="text" id="taxRate" value="${info.taxRate}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">税种:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="taxType" type="text" id="taxType" value="${info.taxType}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">国家:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="country" type="text" id="country" value="${info.country}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">省份:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="province" type="text" id="province" value="${info.province}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">城市:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="city" type="text" id="city" value="${info.city}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">区县:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="district" type="text" id="district" value="${info.district}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>	
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">地址:</td>
			                	<td align="left" class="l-table-edit-td-input" colspan="20">
			                		<textarea type="text" name="address" id="address" style="width:468px;height: 20px;" value="${info.address}"  ltype="text"></textarea>
			                	</td>
			            	</tr>		            	
						</table>
			       	</div>
			     	<div title="财务资料" style="height:275px">
 						<table cellpadding="0" cellspacing="0" class="l-table-edit">
							<tr>
			                	<td align="left" class="l-table-edit-td-label">所属公司编码:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.suCompanyNum" type="text" id="finance.suCompanyNum" value="${info.finance.suCompanyNum}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">所属公司名称:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.suCompanyName" type="text" id="finance.suCompanyName" value="${info.finance.suCompanyName}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">会计联系人:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.accountingPerson" type="text" id="finance.accountingPerson" value="${info.finance.accountingPerson}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">联系人职务:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.personPosition" type="text" id="finance.personPosition" value="${info.finance.personPosition}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">办公电话:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.phone" type="text" id="finance.phone" value="${info.finance.phone}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">手机:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.mobile" type="text" id="finance.mobile" value="${info.finance.mobile}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">邮件:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.mail" type="text" id="finance.mail" value="${info.finance.mail}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">开户银行:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.openBank" type="text" id="finance.openBank" value="${info.finance.openBank}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">银行账号:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.bankAccount" type="text" id="finance.bankAccount" value="${info.finance.bankAccount}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>       
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">币别:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.currency" type="text" id="finance.currency" value="${info.finance.currency}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">账户名称:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="finance.accountName" type="text" id="finance.accountName" value="${info.finance.accountName}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr>
						</table>
			     	</div>
			     	<div title="销售资料" style="height:275px">
 						<table cellpadding="0" cellspacing="0" class="l-table-edit">
							<tr>
			                	<td align="left" class="l-table-edit-td-label">所属公司编码:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.suCompanyNum" type="text" id="sale.suCompanyNum" value="${info.sale.suCompanyNum}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">所属公司名称:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.suCompanyName" type="text" id="sale.suCompanyName" value="${info.sale.suCompanyName}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">应收客户:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.ysCustomer" type="text" id="sale.ysCustomer" value="${info.sale.ysCustomer}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr> 
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">收款客户:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.skCustomer" type="text" id="sale.skCustomer" value="${info.sale.skCustomer}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">送货客户:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.deliverCustomer" type="text" id="sale.deliverCustomer" value="${info.sale.deliverCustomer}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">联系人:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.contactPerson" type="text" id="sale.contactPerson" value="${info.sale.contactPerson}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr> 
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">联系人职务:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.personPosition" type="text" id="sale.personPosition" value="${info.sale.personPosition}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">办公电话:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.phone" type="text" id="sale.phone" value="${info.sale.phone}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label">手机:</td>
			                	<td align="left" class="l-table-edit-td-input"><input name="sale.mobile" type="text" id="sale.mobile" value="${info.sale.mobile}"  ltype="text" /></td>
			                	<td align="left" class="l-table-edit-td-label"></td>
			                	<td align="left" class="l-table-edit-td-input"></td>
			            	</tr> 
			            	<tr>
			                	<td align="left" class="l-table-edit-td-label">地址:</td>
			                	<td align="left" class="l-table-edit-td-input" colspan="20">
			                		<textarea type="text" name="sale.address" id="sale.address" style="width:468px;height: 20px;" value="${info.sale.address}"  ltype="text"></textarea>
			                	</td>
			            	</tr>
						</table>
			     	</div>
			    </div>
			</div>
			<!-- 尾部 -->
			<div class="div-buttom">
				<table cellpadding="0" cellspacing="0" class="l-table-edit">
					<tr>
	                	<td align="left" class="l-table-edit-td-label">备注:</td>
	                	<td align="left" class="l-table-edit-td-input" colspan="20">
	                		<textarea type="text" name="remark" id="remark" style="width:465px;height: 40px" value="${info.remark}"  ltype="text"></textarea>
	                	</td>
			         </tr>
					<tr>
	                	<td align="left" class="l-table-edit-td-label">创建人:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="createUser" type="text" id="createUser" value="${info.createUser.trueName}"  ltype="text" disabled="disabled"/></td>
	                	<td align="left" class="l-table-edit-td-label">修改人:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="alterUser" type="text" id="alterUser" value="${info.alterUser.trueName}"  ltype="text" disabled="disabled"/></td>
	                	<td align="left" class="l-table-edit-td-label">审核人:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="auditUser" type="text" id="auditUser" value="${info.auditUser.trueName}"  ltype="text" disabled="disabled"/></td>
	                	<td align="left" class="l-table-edit-td-label">部门:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="txtName" type="text" id="txtName" value="${info.name}"  ltype="text" /></td>
	            	</tr>
	            	<tr>
	                	<td align="left" class="l-table-edit-td-label">创建日期:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="createDate" type="text" id="createDate" value="${info.createDate}"  ltype="date" disabled="disabled"/></td>
	                	<td align="left" class="l-table-edit-td-label">修改日期:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="alterDate" type="text" id="alterDate" value="${info.alterDate}"  ltype="date" disabled="disabled"/></td>
	                	<td align="left" class="l-table-edit-td-label">审核日期:</td>
	                	<td align="left" class="l-table-edit-td-input"><input name="auditDate" type="text" id="auditDate" value="${info.auditDate}"  ltype="date" disabled="disabled"/></td>
	                	<td align="left" class="l-table-edit-td-label">单据状态:</td>
	                	<td align="left" class="l-table-edit-td-input">
	                		<select name="status" id="status">
								<option id="1" value="1" ${'1' eq info.status?"selected":""}>新增</option>
								<option id="2"  value="2" ${'2' eq info.status?"selected":""}>保存</option>
								<option value="3" ${'3' eq info.status?"selected":""}>提交</option>
								<option value="4" ${'4' eq info.status?"selected":""}>审核</option>
							</select>
	            	</tr>
				</table>
			</div>
			 <br />
	    </form>
	 </div>
    <div style="display:none">
</body>
</html>